Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / feature / node / src / jvmTest / kotlin / org / meshtastic / feature / node / component / PowerMetricsZeroVoltageTest.kt

Displaying Raw • Download

feature/node/src/jvmTest/kotlin/org/meshtastic/feature/node/component/PowerMetricsZeroVoltageTest.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 2.39 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.node.component

Tff7b72import T7ee787androidx.compose.material3.MaterialTheme
Tff7b72import T7ee787androidx.compose.ui.test.ComposeUiTest
Tff7b72import T7ee787androidx.compose.ui.test.ExperimentalTestApi
Tff7b72import T7ee787androidx.compose.ui.test.assertIsDisplayed
Tff7b72import T7ee787androidx.compose.ui.test.onNodeWithText
Tff7b72import T7ee787androidx.compose.ui.test.v2.runComposeUiTest
Tff7b72import T7ee787org.meshtastic.core.model.Node
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787org.meshtastic.proto.PowerMetrics Tff7b72as Te6edf3PowerMetricsProto

T8b949e/**
* `PowerMetrics` channel readings are Wire-generated and nullable, so `null` is the only "no channel" signal. Both the
* absent and the measured-zero case are pinned — either alone lets the two states collapse back into one.
*/
Tf0883e@OptInTb4b4b4(Te6edf3ExperimentalTestApiTff7b72::Te6edf3classTb4b4b4)
Tff7b72class T56d364PowerMetricsZeroVoltageTest Tb4b4b4{

Tf0883e@Test
Tff7b72fun Td2a8ffzeroVoltageChannelIsShownTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Te6edf3setPowerMetricsTb4b4b4(Te6edf3PowerMetricsProtoTb4b4b4(Te6edf3ch1_voltage Tff7b72= T79c0ff0fTb4b4b4, Te6edf3ch1_current Tff7b72= T79c0ff0fTb4b4b4)Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ff0.00VTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ff0.0mATa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffabsentChannelIsHiddenTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Te6edf3setPowerMetricsTb4b4b4(Te6edf3PowerMetricsProtoTb4b4b4(Tb4b4b4)Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ff0.00VTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertDoesNotExistTb4b4b4(Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ff0.0mATa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertDoesNotExistTb4b4b4(Tb4b4b4)
Tb4b4b4}

Tf0883e@Test
Tff7b72fun Td2a8ffreportedVoltageWithoutCurrentShowsVoltageOnlyTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Te6edf3setPowerMetricsTb4b4b4(Te6edf3PowerMetricsProtoTb4b4b4(Te6edf3ch1_voltage Tff7b72= T79c0ff3.7fTb4b4b4)Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ff3.70VTa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Ta5d6ff"Ta5d6ff0.0mATa5d6ff"Tb4b4b4)Tb4b4b4.Te6edf3assertDoesNotExistTb4b4b4(Tb4b4b4)
Tb4b4b4}

Tff7b72private Tff7b72fun Te6edf3ComposeUiTestTb4b4b4.Td2a8ffsetPowerMetricsTb4b4b4(Te6edf3metricsTb4b4b4: Te6edf3PowerMetricsProtoTb4b4b4) Tff7b72= Te6edf3setContent Tb4b4b4{
Te6edf3MaterialTheme Tb4b4b4{ Te6edf3PowerMetricsTb4b4b4(Te6edf3node Tff7b72= Te6edf3NodeTb4b4b4(Te6edf3num Tff7b72= T79c0ff1Tb4b4b4, Te6edf3powerMetrics Tff7b72= Te6edf3metricsTb4b4b4)Tb4b4b4) Tb4b4b4}
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s